<template>
  <button @click="isShow = !isShow">show modal</button>
  <teleport to="body">
    <div class="modal" v-show="isShow">
      <h2>title</h2>
      <p>content</p>
      <button @click="isShow = false">close modal</button>
    </div>
  </teleport>
</template>

<script setup lang="ts" name="Modal">
import { ref } from "vue";

let isShow = ref(false);
</script>

<style scoped>
.modal {
  width: 200px;
  height: 150px;
  background-color: skyblue;
  border-radius: 10px;
  padding: 5px;
  box-shadow: 0 0 5px;
  text-align: center;
  position: fixed;
  left: 50%;
  top: 20px;
  margin-left: -100px;
}
</style>
